package com.ruoyi.wb.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.wb.domain.WbMaintainApply;
import com.ruoyi.wb.mapper.WbMaintainApplyMapper;
import com.ruoyi.wb.service.IWbMaintainApplyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 维保申请Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-10-14
 */
@Service
public class WbMaintainApplyServiceImpl implements IWbMaintainApplyService 
{
    @Autowired
    private WbMaintainApplyMapper wbMaintainApplyMapper;

    /**
     * 查询维保申请
     * 
     * @param id 维保申请主键
     * @return 维保申请
     */
    @Override
    public WbMaintainApply selectWbMaintainApplyById(Long id)
    {
        return wbMaintainApplyMapper.selectWbMaintainApplyById(id);
    }

    /**
     * 查询维保申请列表
     * 
     * @param wbMaintainApply 维保申请
     * @return 维保申请
     */
    @Override
    public List<WbMaintainApply> selectWbMaintainApplyList(WbMaintainApply wbMaintainApply)
    {
        return wbMaintainApplyMapper.selectWbMaintainApplyList(wbMaintainApply);
    }

    /**
     * 新增维保申请
     * 
     * @param wbMaintainApply 维保申请
     * @return 结果
     */
    @Override
    public int insertWbMaintainApply(WbMaintainApply wbMaintainApply)
    {
        wbMaintainApply.setApplyerId(SecurityUtils.getUserId());
        wbMaintainApply.setCreateTime(DateUtils.getNowDate());
        return wbMaintainApplyMapper.insertWbMaintainApply(wbMaintainApply);
    }

    /**
     * 修改维保申请
     * 
     * @param wbMaintainApply 维保申请
     * @return 结果
     */
    @Override
    public int updateWbMaintainApply(WbMaintainApply wbMaintainApply)
    {
        wbMaintainApply.setUpdateTime(DateUtils.getNowDate());
        return wbMaintainApplyMapper.updateWbMaintainApply(wbMaintainApply);
    }

    /**
     * 批量删除维保申请
     * 
     * @param ids 需要删除的维保申请主键
     * @return 结果
     */
    @Override
    public int deleteWbMaintainApplyByIds(Long[] ids)
    {
        return wbMaintainApplyMapper.deleteWbMaintainApplyByIds(ids);
    }

    /**
     * 删除维保申请信息
     * 
     * @param id 维保申请主键
     * @return 结果
     */
    @Override
    public int deleteWbMaintainApplyById(Long id)
    {
        return wbMaintainApplyMapper.deleteWbMaintainApplyById(id);
    }
}
